<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/nav_graph"
    app:startDestination="@id/loginFragment">

    <fragment
        android:id="@+id/catalogFragment"
        android:name="com.example.booking.establishments.ui.CatalogFragment"
        android:label="fragment_catalog"
        tools:layout="@layout/fragment_catalog" >
        <action
            android:id="@+id/action_catalogFragment_to_establishmentFragment"
            app:destination="@id/establishmentFragment" />
        <action
            android:id="@+id/action_catalogFragment_to_profileFragment"
            app:destination="@id/profileFragment" />
    </fragment>
    <fragment
        android:id="@+id/bookingFragment"
        android:name="com.example.booking.bookings.ui.BookingFragment"
        android:label="fragment_booking"
        tools:layout="@layout/fragment_booking" >
        <argument android:name="bookingEstablishmentParam"
            app:argType="com.example.booking.bookings.ui.model.BookingEstablishmentParam" />
        <action
            android:id="@+id/action_bookingFragment_to_catalogFragment"
            app:destination="@id/catalogFragment"
            app:popUpTo="@id/catalogFragment"
            app:popUpToInclusive="true" />
    </fragment>
    <fragment
        android:id="@+id/loginFragment"
        android:name="com.example.booking.auth.ui.LoginFragment"
        android:label="fragment_login"
        tools:layout="@layout/fragment_login" >
        <action
            android:id="@+id/action_loginFragment_to_registrationFragment"
            app:destination="@id/registrationFragment" />
        <action
            android:id="@+id/action_loginFragment_to_catalogFragment"
            app:destination="@id/catalogFragment" />
        <action
            android:id="@+id/action_catalogFragment_root"
            app:destination="@id/catalogFragment"
            app:launchSingleTop="true"
            app:popUpTo="@id/loginFragment"
            app:popUpToInclusive="true" />
    </fragment>
    <fragment
        android:id="@+id/profileFragment"
        android:name="com.example.booking.profile.ui.ProfileFragment"
        android:label="fragment_profile"
        tools:layout="@layout/fragment_profile" >
        <action
            android:id="@+id/action_profileFragment_to_settingsFragment"
            app:destination="@id/settingsFragment" />
        <action
            android:id="@+id/action_profileFragment_to_establishmentFragment"
            app:destination="@id/establishmentFragment" />
    </fragment>
    <fragment
        android:id="@+id/registrationFragment"
        android:name="com.example.booking.auth.ui.RegistrationFragment"
        android:label="fragment_registration"
        tools:layout="@layout/fragment_registration" >
        <action
            android:id="@+id/action_registrationFragment_to_catalogFragment"
            app:destination="@id/catalogFragment" />
        <action
            android:id="@+id/action_registrationFragment_to_loginFragment"
            app:destination="@id/loginFragment"
            app:launchSingleTop="true"
            app:popUpTo="@id/registrationFragment"
            app:popUpToInclusive="true" />
        <action
            android:id="@+id/action_registrationFragment_to_catalogFragment_root"
            app:destination="@id/catalogFragment"
            app:launchSingleTop="true"
            app:popUpTo="@id/loginFragment"
            app:popUpToInclusive="true"/>
    </fragment>
    <fragment
        android:id="@+id/establishmentFragment"
        android:name="com.example.booking.establishments.ui.EstablishmentFragment"
        android:label="fragment_establishment"
        tools:layout="@layout/fragment_establishment" >
        <action
            android:id="@+id/action_establishmentFragment_to_bookingFragment"
            app:destination="@id/bookingFragment" />
        <argument
            android:name="establishmentId"
            app:argType="long" />
    </fragment>
    <fragment
        android:id="@+id/settingsFragment"
        android:name="com.example.booking.profile.ui.SettingsFragment"
        android:label="fragment_settings"
        tools:layout="@layout/fragment_settings" >
        <action
            android:id="@+id/action_settingsFragment_to_loginFragment"
            app:destination="@id/loginFragment"
            app:launchSingleTop="true"
            app:popUpTo="@id/catalogFragment"
            app:popUpToInclusive="true" />
    </fragment>
</navigation>